package com.jn.zhinongbao.adapter.bean;

public class Order {
    public static final int STATUS_PAID = 1; // 已付款
    public static final int STATUS_PENDING_SHIPMENT = 2; // 待发货
    public static final int STATUS_SHIPPED = 3; // 已发货
    public static final int STATUS_CONFIRMED = 4; // 确认收货
    public static final int STATUS_CANCELLED = 5; // 已取消

    private int id;
    private int userId; // 用户ID
    private int merchantId; // 商人ID
    private int productId; // 商品ID
    private String productName; // 商品名称
    private double productPrice; // 商品价格
    private String productImageUrl; // 商品图片
    private int quantity; // 数量
    private double totalAmount; // 总金额
    private int status; // 订单状态
    private String createTime; // 创建时间
    private String updateTime; // 更新时间
    private String shippingAddress; // 收货地址
    private String contactPhone; // 联系电话

    public Order() {}

    public Order(int userId, int merchantId, int productId, String productName, 
                 double productPrice, String productImageUrl, int quantity, 
                 String shippingAddress, String contactPhone) {
        this.userId = userId;
        this.merchantId = merchantId;
        this.productId = productId;
        this.productName = productName;
        this.productPrice = productPrice;
        this.productImageUrl = productImageUrl;
        this.quantity = quantity;
        this.totalAmount = productPrice * quantity;
        this.status = STATUS_PAID; // 默认已付款状态
        this.shippingAddress = shippingAddress;
        this.contactPhone = contactPhone;
    }

    // Getters and Setters
    public int getId() {
        return id;
    }

    public void setId(int id) {
        this.id = id;
    }

    public int getUserId() {
        return userId;
    }

    public void setUserId(int userId) {
        this.userId = userId;
    }

    public int getMerchantId() {
        return merchantId;
    }

    public void setMerchantId(int merchantId) {
        this.merchantId = merchantId;
    }

    public int getProductId() {
        return productId;
    }

    public void setProductId(int productId) {
        this.productId = productId;
    }

    public String getProductName() {
        return productName;
    }

    public void setProductName(String productName) {
        this.productName = productName;
    }

    public double getProductPrice() {
        return productPrice;
    }

    public void setProductPrice(double productPrice) {
        this.productPrice = productPrice;
    }

    public String getProductImageUrl() {
        return productImageUrl;
    }

    public void setProductImageUrl(String productImageUrl) {
        this.productImageUrl = productImageUrl;
    }

    public int getQuantity() {
        return quantity;
    }

    public void setQuantity(int quantity) {
        this.quantity = quantity;
        this.totalAmount = this.productPrice * quantity; // 更新总金额
    }

    public double getTotalAmount() {
        return totalAmount;
    }

    public void setTotalAmount(double totalAmount) {
        this.totalAmount = totalAmount;
    }

    public int getStatus() {
        return status;
    }

    public void setStatus(int status) {
        this.status = status;
    }

    public String getCreateTime() {
        return createTime;
    }

    public void setCreateTime(String createTime) {
        this.createTime = createTime;
    }

    public String getUpdateTime() {
        return updateTime;
    }

    public void setUpdateTime(String updateTime) {
        this.updateTime = updateTime;
    }

    public String getShippingAddress() {
        return shippingAddress;
    }

    public void setShippingAddress(String shippingAddress) {
        this.shippingAddress = shippingAddress;
    }

    public String getContactPhone() {
        return contactPhone;
    }

    public void setContactPhone(String contactPhone) {
        this.contactPhone = contactPhone;
    }

    public String getStatusText() {
        switch (status) {
            case STATUS_PAID:
                return "已付款";
            case STATUS_PENDING_SHIPMENT:
                return "待发货";
            case STATUS_SHIPPED:
                return "已发货";
            case STATUS_CONFIRMED:
                return "确认收货";
            case STATUS_CANCELLED:
                return "已取消";
            default:
                return "未知状态";
        }
    }
} 